<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title></title>
	<link rel="stylesheet" type="text/css" href="../../../global/css/aui.css" />
	<link rel="stylesheet" type="text/css" href="./frm.css?time={$time}" />
</head>
<body>

	<div id="main" class="main aui-content" >
		<div class="content">
            <!-- 默认隐藏跑马灯，有数据再显示  -->
			<div class="invite-marquee aui-hide" id="invite-marquee">
				<img src="../../../global/image/wallet/bell_yellow.png" class="invite-marquee-icon" />
				<div id="invite-marquee-container" class="invite-marquee-container">
				</div>
			</div>
			<!--邀请好友面板-->
			<div id="invite-earn-banner" class="invite-panel aui-hide">
				<div class="invite-share-container" tapmode onclick="views.openShareFrame({shareHot: 1, from: 'invite-earn-banner'});">
					<img src="../../../global/image/invite-earn-bg.png" class="invite-panel-bg" />
				</div>

				<div class="invite-share-skill" tapmode onclick="views.openInviteSkillWin();">
					<div>赚钱技巧</div>
				</div>
			</div>

			<div class="invite-tab aui-card-list-content">
				<div id="invite-tab-bar" class="aui-tab border-bottom">
					<div class="aui-tab-item aui-active" data-idx="1" tapmode>
						<div>热文列表</div>
					</div>
					<div class="aui-tab-item" data-idx="2" tapmode>
                        <p id="new-friends-count" class="aui-badge aui-hide"></p>
						<div>徒弟列表</div>
					</div>
					<div class="aui-tab-item" data-idx="3" tapmode>
						<div>电话本好友</div>
					</div>
				</div>
			</div>

            <div class="auix-solo">
                <!--分享列表-->
                <div id="share-panel" class="auix-solo-item invite-share-list">
                </div>

                <!--好友列表-->
                <div id="friends-panel" class="auix-solo-item invite-friends-table aui-hide">
                    <div class="invite-friends-header border-bottom">
                        <div class="friends-col-1 border-right">
                            <div>徒弟</div>
                        </div>
                        <div id="by-friend-income-frame" class="aui-hide friends-col-2 border-right" tapmode onclick="orderByFriendIncome(this);">
                            <div><span id="by-friend-income" class="manu asc">徒弟总收益</span></div>
                        </div>
                        <div id="by-my-income-frame" class="aui-hide friends-col-3 border-right" tapmode onclick="orderByMyIncome(this);">
                            <div><span id="by-my-income" class="manu asc">我的总收益</span></div>
                        </div>
                        <div class="friends-col-4">
                            <div>操作</div>
                        </div>
                    </div>

                    <div id="friends-list" class="invite-friends-list">
                    </div>

                    <div id="no-friends" class="invite-friends-placeholder aui-hide">
                        <div class="friends-placeholder-container">
                            <img src="../../../global/image/friends.png" />
                            <div id="no-friends-text" class="friends-placeholder-btn" tapmode onclick="onShouTu();">收徒加入阅同城</div>
                        </div>
                    </div>
                </div>

                <!--电话本好友列表-->
                <div id="addr-book-panel" class="auix-solo-item invite-friends-table aui-hide">
                    <div class="invite-friends-header border-bottom">
                        <div class="friends-col-1 border-right">
                            <div>姓名</div>
                        </div>
                        <div class="friends-col-1-sub border-right">
                            <div>阅同城网名</div>
                        </div>
                        <div id="by-friend-income-frame2" class="aui-hide friends-col-2 border-right" tapmode onclick="orderByFriendIncome2(this);">
                            <div><span id="by-friend-income2" class="manu asc">TA的总收益</span></div>
                        </div>
                        <div id="by-my-income-frame2" class="aui-hide friends-col-3 border-right" tapmode onclick="orderByMyIncome2(this);">
                            <div><span id="by-my-income2" class="manu asc">我的总收益</span></div>
                        </div>
                        <div class="friends-col-4 thin">
                            <div>操作</div>
                        </div>
                    </div>

                    <div id="addr-book-list" class="invite-friends-list">
                    </div>
                </div>
            </div>
        </div>
	</div>
</body>

<script id="tpl-share-list" type="text/x-dot-template">
	{{~it :v:i}}
    <div class="invite-share-cell selectedx border-bottom {{=isshared(v.tid)}}" data-tid="{{=v.tid}}" data-fid="{{=v.fid}}" data-from="invite-sharelist" tapmode onclick="ccn() && views.openPostFromList(this);">
        <div class="share-title">{{=decodeEmoji(v.subject)}}</div>
        <div class="share-bottom">
            <div class="share-extras">
                {{~v.items :one:j}}
                <div>
                    <div>{{=one}}</div>
                </div>
                {{~}}
            </div>
            <div class="share-btn" data-tid="{{=v.tid}}" tapmode onclick="shareIt(this, event);">分享({{=(v.my_share || 0)}})</div>
        </div>
    </div>
    {{~}}
</script>

<script id="tpl-friends-list" type="text/x-dot-template">
	{{~it :v:i}}
    <div class="invite-friends-cell border-bottom">
        <div class="friends-col-1 border-right">
    		{{? (1 == v.is_new)}}
                <img src="../../../global/image/invite-new-icon.png" />
            {{?}}
            <div>
                <div class="friends-name">{{=v.username}}</div>
                <div class="friends-content">{{=(obj_being(v.mobile) ? v.mobile : "")}}</div>
            </div>
        </div>
        <div class="{{=soh()}} friends-col-2 border-right">
            <div>{{=v.friend_income}}元</div>
        </div>
        <div class="{{=soh()}} friends-col-3 border-right">
            <div>{{=v.my_income}}元</div>
        </div>
        <div class="friends-col-4">
            <div class="friends-opt-btn" data-uid="{{=v.uid}}" data-device="{{=v.devicetoken}}" data-oper={{=v.operation.id}} data-msg={{=v.operation.message}} data-tid={{=v.operation.sharetid}} tapmode onclick="opFriend(this);">{{=v.operation.name}}</div>
        </div>
    </div>
    {{~}}
</script>

<script id="tpl-addr-book-list" type="text/x-dot-template">
	{{~it :v:i}}
    <div class="invite-friends-cell border-bottom">
        <div class="friends-col-1 border-right">
            <div>
                <div class="friends-namex">{{=(v.full_name || '')}}</div>
                <!-- <div class="friends-content">{{=(obj_being(v.mobile) ? v.mobile : "")}}</div> -->
            </div>
        </div>
        <div class="friends-col-1-sub border-right">
            <div>{{=(v.username || '未注册')}}</div>
        </div>
        <div class="{{=soh()}} friends-col-2 border-right">
            <div>{{=v.friend_income}}元</div>
        </div>
        <div class="{{=soh()}} friends-col-3 border-right">
            <div>{{=v.my_income}}元</div>
        </div>
        <div class="friends-col-4 thin">
            <div class="friends-opt-btn" data-uid="{{=(v.uid || 0)}}" data-device="{{=v.devicetoken}}" data-oper={{=v.operation.id}} data-msg={{=v.operation.message}} data-tid={{=v.operation.sharetid}} tapmode onclick="opFriend(this);">{{=v.operation.name}}</div>
        </div>
    </div>
    {{~}}
</script>

<script id="tpl-marquee" type="text/x-dot-template">
	{{~it :v:i}}
    <div class="invite-marquee-text">{{=v}}</div>
    {{~}}
</script>

<script type="text/javascript" src="../../../config.js?time={$time}"></script>
<script type="text/javascript" src="../../../global/script/lib/api.js?time={$time}"></script>
<script type="text/javascript" src="../../../global/script/lib/doT.min.js"></script>
<script type="text/javascript" src="../../../global/script/lib/zepto.min.js"></script>
<script type="text/javascript" src="../../../global/script/lib/zepto.animate.js"></script>
<script type="text/javascript" src="../../../global/script/lib/aui-tab.js"></script>
<script type="text/javascript" src="../../../global/script/lib/aui-lazyload.js"></script>
<script type="text/javascript" src="../../../global/script/libx/auix-swap.js"></script>
<script type="text/javascript" src="../../../global/script/libx/auix-solo.js"></script>
<script type="text/javascript" src="../../../global/script/mylib.js?time={$time}"></script>

<!-- 这3个文件密不可分 -->
<script type="text/javascript" src="../../../global/script/lib/arale-qrcode.js"></script>
<script type="text/javascript" src="../../../global/script/libx/paintImage.js?time={$time}"></script>
<script type="text/javascript" src="../../../global/script/libx/paintInviteImage.js?time={$time}"></script>

<script type="text/javascript" src="../../../app.js?time={$time}"></script>
<script type="text/javascript" src="./frm.js?time={$time}"></script>

</html>


<script type="text/javascript" src="../../../global/script/_fakeApi.js"></script>
<script type="text/javascript">
    initMisc();
    initSwitch();
    initOrderSwap();
    initOrderSwap2();

    window.pageMode = 0;
    // window.pageMode = 1;
    if (window.pageMode > 0) {
        showIncomeItems();
    }

    // fooMarquee();
    fooRenderShareList();
    fooRenderFriendsList();
    fooRenderAddrBookList();

    // $api.dom('#invite-tab-bar [data-idx="2"]').click();
    // $apix.removeHide($api.byId('no-friends'));

    var nc = $api.byId('new-friends-count');
    $api.html(nc, '10');
    $apix.removeHide(nc);

    function fooRenderAddrBookList() {
        var list = [
            {
                uid: "0",
                devicetoken: "a1000865499032643585",
                username: "老街旧人",
                full_name: "张三",
                my_income: 10,
                friend_income: 100.5,
                operation: {
                    id: 2,
                    name: "提醒xx",
                    message: "亲，来呀",
                    sharetid: 63328,
                },
            },
            {
                uid: null,
                devicetoken: "a1000865499032643585",
                username: null,
                full_name: "张三",
                mobile: "123****2345",
                my_income: 10,
                friend_income: 100.5,
                operation: {
                    id: 1,
                    name: "提醒注册",
                    message: "亲，来呀"
                },
            }
        ];
        var html = doT_Render('#tpl-addr-book-list', list);
        $api.append($api.dom('#addr-book-list'), html);
    }

    function fooRenderFriendsList() {
        var list = [
            {
                uid: "0",
                devicetoken: "a1000865499032643585",
                username: "匿名",
                is_new: 1,
                my_income: 10,
                friend_income: 100.5,
                operation: {
                    id: 2,
                    name: "提醒xx",
                    message: "亲，来呀",
                    sharetid: 63328,
                },
            },
            {
                uid: "0",
                devicetoken: "a1000865499032643585",
                username: "匿名",
                mobile: "123****2345",
                my_income: 10,
                friend_income: 100.5,
                operation: {
                    id: 1,
                    name: "提醒注册",
                    message: "亲，来呀"
                },
            }
        ];
        var html = doT_Render('#tpl-friends-list', list);
        $api.append($api.dom('#friends-list'), html);
    }

    function fooRenderShareList() {
        var list = [
            {
                tid: "335485",
                subject: "【照片】急寻线索！开车遗弃婴儿！今日15:00，一轿车...&gt;&gt;",
                all_share: "740",
                all_income: "100.00",
                my_income: "10.00",
                my_share: '999',
                items: ['分享: 100', '总收益: 100', 'xx收益: 100', 'xxyy收益: 100']
            },
            {
                tid: "335485",
                subject: "【照片】急寻线索！开车遗弃婴儿！今日15:00，一轿车...&gt;&gt;",
                all_share: "740",
                all_income: "100.00",
                my_income: "10.00",
                my_share: '999',
            },
            {
                tid: "335198",
                subject: "刚刚，某地着火！白烟滚滚，疑似有人顶风作案...&gt;&gt;",
                all_share: "388",
                all_income: "100.00",
                my_income: "10.00",
                my_share: '999',
            },
        ];
        var html = doT_Render('#tpl-share-list', list);
        $api.append($api.dom('#share-panel'), html);

        var tid = 335198;
        var dom = $api.dom('#share-panel .invite-share-cell[data-tid="'+tid+'"]');
        $api.addCls(dom, 'shared');
    }

    function fooMarquee() {
        var list = ['1111', '2222', '3333'];
        var html = doT_Render('#tpl-marquee', list);
        $api.append($api.byId('invite-marquee-container'), html);
        window.raceList = list;
        startMarquee();
    }

</script>
